﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;

//resolves the {PATH} in an ITasks text
namespace ecdl.demo.model.util {
    public class TaskPathResolver {
        private IVolumeProvider pathProvider;

        [Inject]
        public TaskPathResolver(IVolumeProvider pathProvider) {
            this.pathProvider = pathProvider;
        }
        
        public void ResolveTask(ITask task) {
            task.Text = task.Text.Replace("{PATH}", pathProvider.GetPath());
        }

        public void ResolveTask(IEnumerable<ITask> tasks) {
            foreach (var task in tasks) {
                ResolveTask(task);
            }
        }
    }
}
